<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProductsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('products', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('bistro_id')->comment('店铺id');
            $table->string('img')->comment('商品图片');
            $table->string('status', 20)->comment('状态')->default('on_sale');
            $table->string('name', 40)->comment('商品名称');
            $table->decimal('discount', 10, 2)->comment('折扣价');
            $table->decimal('price', 10, 2)->comment('价格');
            $table->integer('sale_count')->comment('销售数量')->default(0);
            $table->integer('zan_number')->comment('点赞数量')->default(0);
            $table->text('description')->comment('描述');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('products');
    }
}
